package cn.flightcloud.boot;

import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import cn.flightcloud.boot.commom.springboot.SpringBootErrorPageRegistrar;
import cn.flightcloud.boot.commom.springboot.SpringBootServletContextInitializer;

//@EnableWebMvc
@Configuration
public class MvcConfig extends DelegatingWebMvcConfiguration{
	
	@Override
	protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
		super.configureMessageConverters(converters);
		HttpMessageConverter<?> additional = new StringHttpMessageConverter();
		converters.add(additional);
	}

	@Bean
	public SpringBootErrorPageRegistrar customErrorPageRegistrar() {
		return new SpringBootErrorPageRegistrar();
	}

	@Bean
	public SpringBootServletContextInitializer customServletContextInitializer() {
		return new SpringBootServletContextInitializer();
	}

}
